# from rest_framework import serializers
#
# class ResumeChatSerializer(serializers.Serializer):
#     """简历助手聊天请求序列化器"""
#     prompt = serializers.CharField(
#         required=True,
#         min_length=1,
#         error_messages={"required": "请输入需求", "min_length": "需求不能为空"}
#     )
#     user_id = serializers.CharField(required=False, default="123456789")  # 可选，默认用户ID


from rest_framework import serializers

class ResumeChatSerializer(serializers.Serializer):
    prompt = serializers.CharField(required=True, error_messages={"required": "prompt不能为空"})
    user_id = serializers.CharField(required=True, error_messages={"required": "user_id不能为空"})

    # 若有自定义验证，确保不抛出未处理的异常
    def validate_prompt(self, value):
        if len(value.strip()) == 0:
            raise serializers.ValidationError("prompt不能为空白")
        return value